/**
 * LCR 173. 点名
 */
class Solution9 {
    public int takeAttendance(int[] records) {
        int left = 0, right = records.length;

        while(left < right) {
            int mid = left + (right - left) / 2;
            if(records[mid] == mid) {
                left = mid + 1;
            } else {
                // records[mid] != mid
                right = mid;
            }
        }

        return left;
    }
}